{% extends "base.html" %}
{% block title %}我的博客 - 注册{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <h2 class="mt-4 mb-4">注册</h2>
        <form method="POST" action="">
            {{ form.hidden_tag() }}

            <div class="mb-3">
                {{ form.username.label(class="form-label") }}
                {{ form.username(class="form-control" + (" is-invalid" if form.username.errors else "")) }}
                {% if form.username.errors %}
                <div class="invalid-feedback">
                    {% for error in form.username.errors %}
                    {{ error }}
                    {% endfor %}
                </div>
                {% endif %}
            </div>

            <div class="mb-3">
                {{ form.email.label(class="form-label") }}
                {{ form.email(class="form-control" + (" is-invalid" if form.email.errors else "")) }}
                {% if form.email.errors %}
                <div class="invalid-feedback">
                    {% for error in form.email.errors %}
                    {{ error }}
                    {% endfor %}
                </div>
                {% endif %}
            </div>

            <div class="mb-3">
                {{ form.password.label(class="form-label") }}
                {{ form.password(class="form-control" + (" is-invalid" if form.password.errors else "")) }}
                {% if form.password.errors %}
                <div class="invalid-feedback">
                    {% for error in form.password.errors %}
                    {{ error }}
                    {% endfor %}
                </div>
                {% endif %}
            </div>

            <div class="mb-3">
                {{ form.confirm_password.label(class="form-label") }}
                {{ form.confirm_password(class="form-control" + (" is-invalid" if form.confirm_password.errors else ""))
                }}
                {% if form.confirm_password.errors %}
                <div class="invalid-feedback">
                    {% for error in form.confirm_password.errors %}
                    {{ error }}
                    {% endfor %}
                </div>
                {% endif %}
            </div>

            <div class="d-grid">
                {{ form.submit(class="btn btn-primary") }}
            </div>
        </form>

        <div class="mt-3 text-center">
            <p>已有账号？<a href="{{ url_for('auth.login') }}">立即登录</a></p>
        </div>
    </div>
</div>
</div>
{% endblock %}